#include <iostream>
#include<opencv2/opencv.hpp>
using namespace cv;
int main(int argc, const char * argv[]) {
    // insert code here...
    Mat img = imread("./opencv.png");
    
    Mat bgr[3];
    split(img,&bgr[0]);
    namedWindow("Lena");
    imwrite("./opencv_b.bmp",bgr[0]); 
    imwrite("./opencv_g.bmp",bgr[1]); 
    imwrite("./opencv_r.bmp",bgr[2]); 
    img = imread("./lena.jpg");

    Mat shv;
    cvtColor(img,shv,COLOR_BGR2HSV);
    imshow("SHV",shv);
    Mat temp[3];
    split(shv,&temp[0]);

    imshow("S",temp[0]);
    imshow("H",temp[1]);
    imshow("V",temp[2]);
    waitKey();

    imwrite("./lena_s.bmp",temp[0]);
    imwrite("./lena_h.bmp",temp[1]);
    imwrite("./lena_v.bmp",temp[2]);
    return 0;//4028947
}
